cmake_minimum_required(VERSION 2.6)

project(Xylex)

set(Xylex_VERSION_MAJOR 0)
set(Xylex_VERSION_MINOR 1)
set(Xylex_VERSION_REV 1)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
  "${CMAKE_SOURCE_DIR}/CMake"
  "${CMAKE_SOURCE_DIR}/CMake/Packages"
  "${CMAKE_SOURCE_DIR}/CMake/Utils"
)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bin)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/Bin)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../)

# ----------( Configuration )----------

# Choose which components to build
option(BUILD_CLIENT "Build the Client" TRUE)
option(BUILD_SERVER "Build the Server" TRUE)

# -------------------------------------

set(cAudio_INCLUDE_DIRS "")
set(cAudio_LIBRARIES "")


if(BUILD_CLIENT OR BUILD_SERVER)
  find_package(ENet REQUIRED)
  include_directories(${ENet_INCLUDE_DIRS})
  include_directories("${CMAKE_CURRENT_SOURCE_DIR}/Libs/boost")
endif()

if(BUILD_CLIENT)
  # Dependencies
  find_package(Bullet REQUIRED)
  include_directories(${Bullet_INCLUDE_DIRS})

  find_package(cAudio REQUIRED)
  include_directories(${cAudio_INCLUDE_DIRS})

  find_package(ENet REQUIRED)
  include_directories(${ENet_INCLUDE_DIRS})

  find_package(MyGUI REQUIRED)
  include_directories(${MyGUI_INCLUDE_DIRS})

  find_package(OGRE REQUIRED)
  include_directories(${OGRE_INCLUDE_DIRS})

  find_package(OIS REQUIRED)
  include_directories(${OIS_INCLUDE_DIRS})

  add_subdirectory(Common)
  add_subdirectory(Graphics)
  add_subdirectory(GUI)
  add_subdirectory(Input)
  add_subdirectory(Network)
  add_subdirectory(Physics)
  add_subdirectory(Sound)
  add_subdirectory(Client)
endif()

if(BUILD_SERVER)
  add_subdirectory(Server)
endif()
